<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>启动</title>
</head>

<style>
    #sp{
        width: 200px;
        height: 200px;
        background: aqua;
    }


</style>

<script>


</script>


<body>

<center>

    <div>
        <h1>欢迎访问我的网站</h1>
    </div>


当前状态：<span id="span">离线</span>


<br>


<label for="mySelect">你是:</label>
<select id="mySelect" name="name">
    <option value="name1">1</option>
    <option value="name2">2</option>
    <option value="name3">3</option>
    <option value="name4">5</option>
    <option value="name5">6</option>
    <option value="name6">7</option>
    <option value="name7">0</option>
</select>
<br>

<button type="submit" id="buttonId" onclick="f()">go</button>


<br>

日志：
    <textarea id="sp"></textarea>

<script>

    function f() {
        // 获取button的文字
        var button = document.getElementById("buttonId");
        var innerText = button.innerText;
        console.log(innerText)
        if(innerText == "go"){
            document.getElementById("buttonId").innerHTML = "come";
            document.getElementById("sp").value += innerText+"\n";
            document.getElementById("span").innerHTML = "上线";
        }
        if(innerText == "come"){
            document.getElementById("buttonId").innerHTML = "go";
            document.getElementById("sp").value += innerText+"\n";
            document.getElementById("span").innerHTML = "下线";
        }

        // 假设select的id为"mySelect"
        var selectElement = document.getElementById("mySelect");
        var selectedValue = selectElement.options[selectElement.selectedIndex].value;
        var xhr = new XMLHttpRequest();

        xhr.open("POST", "http://192.168.0.1/a", true);
        xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        xhr.timeout = 5000;
        xhr.send(selectedValue);

        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4 && xhr.status == 200) {
                console.log(xhr.responseText);
                document.getElementById("sp").value += xhr.responseText;
            }
        };
    }

</script>

<hr>


<div style="font-size: 90px">由于近期长期受到不明ip攻击，导致我们的网站无法正常运行，所以敬请期待</div>


<hr>

&copy; 浙ICP备2024072455号


</center>
</body>
</html>